<template>
	<view class="home hv100 bg-shop clearfix ">
		<cu-custom bgColor="bg-white" isBack>
			<block slot="content">搜索结果</block>
		</cu-custom> 
		<view class="flex align-center flex-wrap justify-between px15">
			<view class="tuijian-box flex flex-direction mt15" v-for="(item, index) in List" @click="pushPage('/pages/goods/index?id=' + item.id)" :key="index">
				<image :src="item.pic" class="tuijian-pic"></image>
				<view class="bg-white flex flex-direction px5 py10">
					<view class="f12 ellipsis2 mt5 bg-white ">{{ item.name }}</view>
					<text class="text-prices mt10">￥{{ item.money }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState, mapActions } from 'vuex'
export default {
	data() {
		return {
			id:'',
			title:'',
			List:[],
			type:'',
		}
	},
	onLoad(e) {
		this.title=e.title
		this.getgoods()
	},
	onReachBottom() {
		this.getgoods()
	},
	methods: {
		...mapActions(['setLocale']),
		async getgoods(){
			if (this.finish) return
			let {
				data:{typegoods}
			} = await this.$http.post("home.searchpage", {page:this.page, name: this.title }, { tipConfig: { storeLoading: true } })
			this.finish = typegoods.length < 20
			!this.finish && (this.page += 1)
			this.List = [...this.List, ...typegoods]
		},
	}
}
</script>
<style lang="less">
.tuijian-box{
	width: 320rpx;
}
.tuijian-pic {
	width: 320rpx;
	height: 320rpx;
}
</style>
